import { Body, Controller, Post } from '@nestjs/common';
import { AuthService } from './auth.service';
import { SignUpDto } from './dto/sign-up.dto';
import { SignInDto } from './dto/sign-in.dto';
import { Public } from 'src/common/decorators/public.decorator';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';

@ApiTags('Auth')
@Controller('auth')
export class AutoController {
  constructor(private readonly authService: AuthService) {}

  @ApiOperation({ summary: '注册账号' })
  @Post('signup')
  @Public()
  singUp(@Body() singUpDto: SignUpDto) {
    return this.authService.signUp(singUpDto);
  }
  @ApiResponse({ type: String, description: 'token' })
  @ApiOperation({ summary: '登录账号' })
  @Post('signin')
  @Public()
  signIn(@Body() signInDto: SignInDto) {
    return this.authService.signIn(signInDto);
  }
}
